/*
 * Copyright (c) 2012-2020 MIRACL UK Ltd.
 *
 * This file is part of MIRACL Core
 * (see https://github.com/miracl/core).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

//
//  rom.swift
//
//  Created by Michael Scott on 12/06/2015.
//  Copyright (c) 2015 Michael Scott. All rights reserved.
//

import core

public struct ROM{
 
#if D32

// Base Bits= 28
// BN254 Curve Modulus
static let Modulus:[Chunk] = [0x13,0x0,0x13A7,0x0,0x86121,0x8000000,0x1BA344D,0x4000000,0x5236482,0x2]
static let ROI:[Chunk] = [0x12,0x0,0x13A7,0x0,0x86121,0x8000000,0x1BA344D,0x4000000,0x5236482,0x2]
static let R2modp:[Chunk] = [0xF5E7E39,0x2F2A96F,0xB96F13C,0x64E8642,0xC7146,0x9926F7B,0x4DACD24,0x8321E7B,0xD127A2E,0x1]
static let MConst:Chunk = 0x79435E5
static let SQRTm3:[Chunk] = [0x4,0x0,0x60C,0x0,0x3CF0F,0x0,0x126CD89,0x4000000,0x5236482,0x2]
static let Fra:[Chunk] = [0xF2A6DE9,0x7DE6C06,0xF77C2E1,0x74924D3,0x53F8509,0x50A8469,0xCB6499B,0x212E7C8,0xB377619,0x1]
static let Frb:[Chunk] = [0xD5922A,0x82193F9,0x8850C5,0x8B6DB2C,0xAC8DC17,0x2F57B96,0x503EAB2,0x1ED1837,0x9EBEE69,0x0]

// BN254 Curve

static let CURVE_Cof_I:Int = 1
static let CURVE_B_I:Int = 2
static let CURVE_B:[Chunk] = [0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]
static public let CURVE_Order:[Chunk] = [0xD,0x0,0x10A1,0x8000000,0x7FF9F,0x8000000,0x1BA344D,0x4000000,0x5236482,0x2]
static public let CURVE_Gx:[Chunk] = [0x12,0x0,0x13A7,0x0,0x86121,0x8000000,0x1BA344D,0x4000000,0x5236482,0x2]
static public let CURVE_Gy:[Chunk] = [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]
static public let CURVE_HTPC:[Chunk] = [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]
static let CURVE_Bnx:[Chunk] = [0x1,0x8000000,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0]
static let CURVE_Cof:[Chunk] = [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]
static let CRu:[Chunk] = [0x7,0x8000000,0x6CD,0x0,0x24909,0x4000000,0x49B362,0x0,0x0,0x0]
static public let CURVE_Pxa:[Chunk] = [0x803FB2B,0xEE4224C,0x8BF0D91,0x8BBB489,0xDB6A464,0x7E8C61E,0xFEB8D8C,0x519EB62,0x61A10BB,0x0]
static public let CURVE_Pxb:[Chunk] = [0x7D54CF3,0x8C34C1E,0x784B70D,0x746BAE3,0xA5B1F4D,0x8C5982A,0x3310AA7,0xBA73783,0x516AAF9,0x0]
static public let CURVE_Pya:[Chunk] = [0x1CD2B9A,0xF0E0789,0xE09BD19,0xAE6BDB,0x22329BD,0x96698C8,0x39A90E0,0x6BAF934,0x21897A0,0x0]
static public let CURVE_Pyb:[Chunk] = [0xB3ACE9B,0x2D1AEC6,0x9C9578A,0x6FFD73,0xD37B090,0x56F5F38,0x68F6D44,0x7C8B152,0xEBB2B0E,0x0]
static let CURVE_W:[[Chunk]] = [[0x3,0x0,0x204,0x8000000,0x6181,0x0,0x0,0x0,0x0,0x0],[0x1,0x0,0x81,0x0,0x0,0x0,0x0,0x0,0x0,0x0]]
static let CURVE_SB:[[[Chunk]]] = [[[0x4,0x0,0x285,0x8000000,0x6181,0x0,0x0,0x0,0x0,0x0],[0x1,0x0,0x81,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x1,0x0,0x81,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0xA,0x0,0xE9D,0x0,0x79E1E,0x8000000,0x1BA344D,0x4000000,0x5236482,0x2]]]
static let CURVE_WB:[[Chunk]] = [[0x0,0x8000000,0x40,0x8000000,0x2080,0x0,0x0,0x0,0x0,0x0],[0x5,0x8000000,0x54A,0x0,0x1C707,0x8000000,0x312241,0x0,0x0,0x0],[0x3,0x8000000,0x2C5,0x8000000,0xE383,0xC000000,0x189120,0x0,0x0,0x0],[0x1,0x8000000,0xC1,0x8000000,0x2080,0x0,0x0,0x0,0x0,0x0]]
static let CURVE_BB:[[[Chunk]]] = [[[0xD,0x8000000,0x1060,0x8000000,0x7FF9F,0x8000000,0x1BA344D,0x4000000,0x5236482,0x2],[0xC,0x8000000,0x1060,0x8000000,0x7FF9F,0x8000000,0x1BA344D,0x4000000,0x5236482,0x2],[0xC,0x8000000,0x1060,0x8000000,0x7FF9F,0x8000000,0x1BA344D,0x4000000,0x5236482,0x2],[0x2,0x0,0x81,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x1,0x0,0x81,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0xC,0x8000000,0x1060,0x8000000,0x7FF9F,0x8000000,0x1BA344D,0x4000000,0x5236482,0x2],[0xD,0x8000000,0x1060,0x8000000,0x7FF9F,0x8000000,0x1BA344D,0x4000000,0x5236482,0x2],[0xC,0x8000000,0x1060,0x8000000,0x7FF9F,0x8000000,0x1BA344D,0x4000000,0x5236482,0x2]],[[0x2,0x0,0x81,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x1,0x0,0x81,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x1,0x0,0x81,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x1,0x0,0x81,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x2,0x8000000,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x2,0x0,0x102,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0xA,0x0,0x1020,0x8000000,0x7FF9F,0x8000000,0x1BA344D,0x4000000,0x5236482,0x2],[0x2,0x8000000,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0]]]


#endif

#if D64

// Base Bits= 56
// BN254 Curve Modulus
static let Modulus:[Chunk] = [0x13,0x13A7,0x80000000086121,0x40000001BA344D,0x25236482]
static let ROI:[Chunk] = [0x12,0x13A7,0x80000000086121,0x40000001BA344D,0x25236482]
static let R2modp:[Chunk] = [0x2F2A96FF5E7E39,0x64E8642B96F13C,0x9926F7B00C7146,0x8321E7B4DACD24,0x1D127A2E]
static let MConst:Chunk = 0x435E50D79435E5
static let SQRTm3:[Chunk] = [0x4,0x60C,0x3CF0F,0x4000000126CD89,0x25236482]
static public let Fra:[Chunk] = [0x7DE6C06F2A6DE9,0x74924D3F77C2E1,0x50A846953F8509,0x212E7C8CB6499B,0x1B377619]
static public let Frb:[Chunk] = [0x82193F90D5922A,0x8B6DB2C08850C5,0x2F57B96AC8DC17,0x1ED1837503EAB2,0x9EBEE69]

// BN254 Curve

static let CURVE_Cof_I:Int = 1
static let CURVE_B_I:Int = 2
static let CURVE_B:[Chunk] = [0x2,0x0,0x0,0x0,0x0]
static public let CURVE_Order:[Chunk] = [0xD,0x800000000010A1,0x8000000007FF9F,0x40000001BA344D,0x25236482]
static public let CURVE_Gx:[Chunk] = [0x12,0x13A7,0x80000000086121,0x40000001BA344D,0x25236482]
static public let CURVE_Gy:[Chunk] = [0x1,0x0,0x0,0x0,0x0]
static public let CURVE_HTPC:[Chunk] = [0x1,0x0,0x0,0x0,0x0]
static let CURVE_Bnx:[Chunk] = [0x80000000000001,0x40,0x0,0x0,0x0]
static let CURVE_Cof:[Chunk] = [0x1,0x0,0x0,0x0,0x0]
static let CRu:[Chunk] = [0x80000000000007,0x6CD,0x40000000024909,0x49B362,0x0]
static public let CURVE_Pxa:[Chunk] = [0xEE4224C803FB2B,0x8BBB4898BF0D91,0x7E8C61EDB6A464,0x519EB62FEB8D8C,0x61A10BB]
static public let CURVE_Pxb:[Chunk] = [0x8C34C1E7D54CF3,0x746BAE3784B70D,0x8C5982AA5B1F4D,0xBA737833310AA7,0x516AAF9]
static public let CURVE_Pya:[Chunk] = [0xF0E07891CD2B9A,0xAE6BDBE09BD19,0x96698C822329BD,0x6BAF93439A90E0,0x21897A0]
static public let CURVE_Pyb:[Chunk] = [0x2D1AEC6B3ACE9B,0x6FFD739C9578A,0x56F5F38D37B090,0x7C8B15268F6D44,0xEBB2B0E]
static let CURVE_W:[[Chunk]] = [[0x3,0x80000000000204,0x6181,0x0,0x0],[0x1,0x81,0x0,0x0,0x0]]
static let CURVE_SB:[[[Chunk]]] = [[[0x4,0x80000000000285,0x6181,0x0,0x0],[0x1,0x81,0x0,0x0,0x0]],[[0x1,0x81,0x0,0x0,0x0],[0xA,0xE9D,0x80000000079E1E,0x40000001BA344D,0x25236482]]]
static let CURVE_WB:[[Chunk]] = [[0x80000000000000,0x80000000000040,0x2080,0x0,0x0],[0x80000000000005,0x54A,0x8000000001C707,0x312241,0x0],[0x80000000000003,0x800000000002C5,0xC000000000E383,0x189120,0x0],[0x80000000000001,0x800000000000C1,0x2080,0x0,0x0]]
static let CURVE_BB:[[[Chunk]]] = [[[0x8000000000000D,0x80000000001060,0x8000000007FF9F,0x40000001BA344D,0x25236482],[0x8000000000000C,0x80000000001060,0x8000000007FF9F,0x40000001BA344D,0x25236482],[0x8000000000000C,0x80000000001060,0x8000000007FF9F,0x40000001BA344D,0x25236482],[0x2,0x81,0x0,0x0,0x0]],[[0x1,0x81,0x0,0x0,0x0],[0x8000000000000C,0x80000000001060,0x8000000007FF9F,0x40000001BA344D,0x25236482],[0x8000000000000D,0x80000000001060,0x8000000007FF9F,0x40000001BA344D,0x25236482],[0x8000000000000C,0x80000000001060,0x8000000007FF9F,0x40000001BA344D,0x25236482]],[[0x2,0x81,0x0,0x0,0x0],[0x1,0x81,0x0,0x0,0x0],[0x1,0x81,0x0,0x0,0x0],[0x1,0x81,0x0,0x0,0x0]],[[0x80000000000002,0x40,0x0,0x0,0x0],[0x2,0x102,0x0,0x0,0x0],[0xA,0x80000000001020,0x8000000007FF9F,0x40000001BA344D,0x25236482],[0x80000000000002,0x40,0x0,0x0,0x0]]]

#endif

}

